<?php
// $Id: views_plugin_style_rss.inc,v 1.2 2008/12/02 00:02:06 merlinofchaos Exp $
/**
 * @file
 * Contains the RSS style plugin.
 */

/**
 * Default style plugin to render an RSS feed.
 *
 * @ingroup views_style_plugins
 */
class views_plugin_style_xml extends views_plugin_style {

  function option_definition() {
    $options = parent::option_definition();

    $options['root_tag'] = array('default' => '', 'translatable' => FALSE);

    return $options;
  }

  function options_form(&$form, &$form_state) {
    $form['root_tag'] = array(
      '#type' => 'textfield',
      '#title' => t('Xml root tag'),
      '#default_value' => $this->options['root_tag'],
      '#description' => t('This will be the xml root tag.'),
    );
  }

  function render() {
    if (empty($this->row_plugin)) {
      vpr('views_plugin_style_default: Missing row plugin');
      return;
    }
    $rows = '';

    foreach ($this->view->result as $row) {
      $rows .= $this->row_plugin->render($row);
    }
    //exit(print_r($this->row_plugin));
    return theme($this->theme_functions(), $this->view, $this->options, $rows);
  }
}
